package models;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import play.db.jpa.Model;

@Entity
@Table(name = "news")
public class News extends Model {

	@Column(name = "content")
	public String content;
	@Column(name = "ctime", length = 19)
	public Date ctime;
	@Column(name = "source")
	public String source;
	@Column(name = "title")
	public String title;

	public News() {
	}

	public News(String content, Date ctime, String source, String title) {
		this.content = content;
		this.ctime = ctime;
		this.source = source;
		this.title = title;
	}

	public static List<News> getLately(int size){
		
		return News.find("order by ctime desc").fetch(size);
	}
	
}